

# Required packages
install.packages(c("data.table","minpack.lm","ggplot2","foreach","doParallel","cowplot","viridis"), dependencies = TRUE)
library(data.table); library(minpack.lm); library(ggplot2)
library(foreach); library(doParallel); library(cowplot); library(viridis); library(exuber)

###minw is calculated using the formula they provided "(0.01+1.8/square-root of T)multiply by T" where where T denotes the sample size

###import the data. mine is called Gold

goldtest = radf(Gold, minw = 81, lag = 0)
mc1 = radf_mc_cv(n = 2054, nrep = 5000, minw = 81)

summary(goldtest, mc1)

autoplot2(goldtest, mc1)

gstest = radf(gs, minw = 81, lag = 0)
summary(gstest, mc1)

sgtest = radf(sg, minw = 81, lag = 0)
summary(sgtest, mc1)

autoplot2(sgtest, mc1)
datestamp_results1 = datestamp(sgtest, mc1, min_duration = 3)

summary(datestamp_results1)

autoplot(datestamp_results1)
print(datestamp_results1)



autoplot2(sgtest, mc1)

autoplot2(gstest, mc1)
datestamp_results2 = datestamp(gstest, mc1, min_duration = 3)

summary(datestamp_results2)

autoplot(datestamp_results2)
print(datestamp_results2)

datestamp_results4 = datestamp(goldtest, mc1, min_duration = 3)
print(datestamp_results4)